// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Configuration for a Google SPLA product
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Configuration {
    /// Identifier. name of resource
    pub name: std::string::String,

    /// Required. User given name.
    pub display_name: std::string::String,

    /// Required. Name field (with URL) of the Product offered for SPLA.
    pub product: std::string::String,

    /// Required. LicenseType to be applied for billing
    pub license_type: crate::model::LicenseType,

    /// Required. Billing information applicable till end of the current month.
    pub current_billing_info: std::option::Option<crate::model::BillingInfo>,

    /// Required. Billing information applicable for next month.
    pub next_billing_info: std::option::Option<crate::model::BillingInfo>,

    /// Output only. [Output only] Create time stamp
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. [Output only] Update time stamp
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Labels as key value pairs
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. State of the configuration.
    pub state: crate::model::configuration::State,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Configuration {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Configuration::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Configuration::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [product][crate::model::Configuration::product].
    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.product = v.into();
        self
    }

    /// Sets the value of [license_type][crate::model::Configuration::license_type].
    pub fn set_license_type<T: std::convert::Into<crate::model::LicenseType>>(
        mut self,
        v: T,
    ) -> Self {
        self.license_type = v.into();
        self
    }

    /// Sets the value of [current_billing_info][crate::model::Configuration::current_billing_info].
    pub fn set_current_billing_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BillingInfo>,
    {
        self.current_billing_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [current_billing_info][crate::model::Configuration::current_billing_info].
    pub fn set_or_clear_current_billing_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BillingInfo>,
    {
        self.current_billing_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [next_billing_info][crate::model::Configuration::next_billing_info].
    pub fn set_next_billing_info<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::BillingInfo>,
    {
        self.next_billing_info = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [next_billing_info][crate::model::Configuration::next_billing_info].
    pub fn set_or_clear_next_billing_info<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::BillingInfo>,
    {
        self.next_billing_info = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::Configuration::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Configuration::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Configuration::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Configuration::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Configuration::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [state][crate::model::Configuration::state].
    pub fn set_state<T: std::convert::Into<crate::model::configuration::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }
}

impl wkt::message::Message for Configuration {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.Configuration"
    }
}

/// Defines additional types related to [Configuration].
pub mod configuration {
    #[allow(unused_imports)]
    use super::*;

    /// State of the configuration.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The Status of the configuration is unspecified
        Unspecified,
        /// Configuration is in active state.
        Active,
        /// Configuration is in deactivated state.
        Suspended,
        /// Configuration is in deleted state.
        Deleted,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::Suspended => std::option::Option::Some(2),
                Self::Deleted => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("STATE_ACTIVE"),
                Self::Suspended => std::option::Option::Some("STATE_SUSPENDED"),
                Self::Deleted => std::option::Option::Some("STATE_DELETED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::Suspended,
                3 => Self::Deleted,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "STATE_ACTIVE" => Self::Active,
                "STATE_SUSPENDED" => Self::Suspended,
                "STATE_DELETED" => Self::Deleted,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::Suspended => serializer.serialize_i32(2),
                Self::Deleted => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.licensemanager.v1.Configuration.State",
            ))
        }
    }
}

/// Billing Information.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BillingInfo {
    /// Output only. When the billing starts.
    pub start_time: std::option::Option<wkt::Timestamp>,

    /// Output only. When the billing ends.
    pub end_time: std::option::Option<wkt::Timestamp>,

    pub current_billing_info: std::option::Option<crate::model::billing_info::CurrentBillingInfo>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl BillingInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [start_time][crate::model::BillingInfo::start_time].
    pub fn set_start_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [start_time][crate::model::BillingInfo::start_time].
    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::BillingInfo::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::BillingInfo::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [current_billing_info][crate::model::BillingInfo::current_billing_info].
    ///
    /// Note that all the setters affecting `current_billing_info` are mutually
    /// exclusive.
    pub fn set_current_billing_info<
        T: std::convert::Into<std::option::Option<crate::model::billing_info::CurrentBillingInfo>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.current_billing_info = v.into();
        self
    }

    /// The value of [current_billing_info][crate::model::BillingInfo::current_billing_info]
    /// if it holds a `UserCountBilling`, `None` if the field is not set or
    /// holds a different branch.
    pub fn user_count_billing(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::UserCountBillingInfo>> {
        #[allow(unreachable_patterns)]
        self.current_billing_info.as_ref().and_then(|v| match v {
            crate::model::billing_info::CurrentBillingInfo::UserCountBilling(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [current_billing_info][crate::model::BillingInfo::current_billing_info]
    /// to hold a `UserCountBilling`.
    ///
    /// Note that all the setters affecting `current_billing_info` are
    /// mutually exclusive.
    pub fn set_user_count_billing<
        T: std::convert::Into<std::boxed::Box<crate::model::UserCountBillingInfo>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.current_billing_info = std::option::Option::Some(
            crate::model::billing_info::CurrentBillingInfo::UserCountBilling(v.into()),
        );
        self
    }
}

impl wkt::message::Message for BillingInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.BillingInfo"
    }
}

/// Defines additional types related to [BillingInfo].
pub mod billing_info {
    #[allow(unused_imports)]
    use super::*;

    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum CurrentBillingInfo {
        /// Required. This type of billing uses user count for computing total
        /// charge.
        UserCountBilling(std::boxed::Box<crate::model::UserCountBillingInfo>),
    }
}

/// This approach uses total unique user count for billing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserCountBillingInfo {
    /// Required. Number of users to bill for.
    pub user_count: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UserCountBillingInfo {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [user_count][crate::model::UserCountBillingInfo::user_count].
    pub fn set_user_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.user_count = v.into();
        self
    }
}

impl wkt::message::Message for UserCountBillingInfo {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.UserCountBillingInfo"
    }
}

/// Message representing usage for license configurations which use user-count
/// billing.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UserCountUsage {
    /// Required. Unique number of licensed users.
    pub unique_user_count: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UserCountUsage {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [unique_user_count][crate::model::UserCountUsage::unique_user_count].
    pub fn set_unique_user_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.unique_user_count = v.into();
        self
    }
}

impl wkt::message::Message for UserCountUsage {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.UserCountUsage"
    }
}

/// Products for Google SPLA.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Product {
    /// Identifier. Full name of the product resource.
    /// ex "projects/1/locations/us-central1/products/office-2021"
    pub name: std::string::String,

    /// Required. Version of the product.
    pub version: std::string::String,

    /// Required. Company that released the product.
    pub product_company: std::string::String,

    /// Output only. State of the product.
    pub state: crate::model::product::State,

    /// Required. SKU for mapping to the Billing/Subscription resource.
    pub sku: std::string::String,

    /// Required. Human-readable, detailed description of the Product
    pub description: std::string::String,

    /// Required. Human-readable name of the Product
    pub display_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Product {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Product::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [version][crate::model::Product::version].
    pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.version = v.into();
        self
    }

    /// Sets the value of [product_company][crate::model::Product::product_company].
    pub fn set_product_company<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.product_company = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Product::state].
    pub fn set_state<T: std::convert::Into<crate::model::product::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [sku][crate::model::Product::sku].
    pub fn set_sku<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.sku = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Product::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::Product::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }
}

impl wkt::message::Message for Product {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.Product"
    }
}

/// Defines additional types related to [Product].
pub mod product {
    #[allow(unused_imports)]
    use super::*;

    /// State of the product.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The Status of the product is unknown.
        Unspecified,
        /// Product is under provisioning stage.
        Provisioning,
        /// Product is ok to run on instances.
        Running,
        /// The product is about to terminate or has been announced for termination.
        Terminating,
        /// The product has been terminated.
        Terminated,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Provisioning => std::option::Option::Some(1),
                Self::Running => std::option::Option::Some(2),
                Self::Terminating => std::option::Option::Some(3),
                Self::Terminated => std::option::Option::Some(4),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Provisioning => std::option::Option::Some("STATE_PROVISIONING"),
                Self::Running => std::option::Option::Some("STATE_RUNNING"),
                Self::Terminating => std::option::Option::Some("STATE_TERMINATING"),
                Self::Terminated => std::option::Option::Some("STATE_TERMINATED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Provisioning,
                2 => Self::Running,
                3 => Self::Terminating,
                4 => Self::Terminated,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "STATE_PROVISIONING" => Self::Provisioning,
                "STATE_RUNNING" => Self::Running,
                "STATE_TERMINATING" => Self::Terminating,
                "STATE_TERMINATED" => Self::Terminated,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Provisioning => serializer.serialize_i32(1),
                Self::Running => serializer.serialize_i32(2),
                Self::Terminating => serializer.serialize_i32(3),
                Self::Terminated => serializer.serialize_i32(4),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.licensemanager.v1.Product.State",
            ))
        }
    }
}

/// Message describing Instance object
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Instance {
    /// Identifier. name of resource
    pub name: std::string::String,

    /// Output only. [Output only] Create time stamp
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. [Output only] Update time stamp
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Labels as key value pairs
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Output only. The state of the VM.
    pub state: crate::model::instance::State,

    /// Output only. The location of the VM.
    pub region: std::string::String,

    /// Output only. Map with Product_Name and Activation State of the VM.
    pub product_activation:
        std::collections::HashMap<std::string::String, crate::model::ActivationState>,

    /// Output only. license version id.
    pub license_version_id: std::string::String,

    /// Required. Compute Instance resource name, i.e.
    /// projects/{project}/zones/{zone}/instances/{instance}
    pub compute_instance: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Instance {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Instance::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Instance::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Instance::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Instance::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [state][crate::model::Instance::state].
    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [region][crate::model::Instance::region].
    pub fn set_region<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.region = v.into();
        self
    }

    /// Sets the value of [product_activation][crate::model::Instance::product_activation].
    pub fn set_product_activation<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<crate::model::ActivationState>,
    {
        use std::iter::Iterator;
        self.product_activation = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [license_version_id][crate::model::Instance::license_version_id].
    pub fn set_license_version_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.license_version_id = v.into();
        self
    }

    /// Sets the value of [compute_instance][crate::model::Instance::compute_instance].
    pub fn set_compute_instance<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.compute_instance = v.into();
        self
    }
}

impl wkt::message::Message for Instance {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.Instance"
    }
}

/// Defines additional types related to [Instance].
pub mod instance {
    #[allow(unused_imports)]
    use super::*;

    /// VM status enum.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// The Status of the VM is unspecified.
        Unspecified,
        /// Resources are being allocated for the instance.
        Provisioning,
        /// All required resources have been allocated and
        /// the instance is being started.
        Staging,
        /// The instance is running.
        Running,
        /// The instance is currently stopping (either being deleted or terminated).
        Stopping,
        /// The instance has stopped due to various reasons (user request, VM
        /// preemption, project freezing, etc.).
        Stopped,
        /// The instance has failed in some way.
        Terminated,
        /// The instance is in repair.
        Repairing,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Provisioning => std::option::Option::Some(1),
                Self::Staging => std::option::Option::Some(2),
                Self::Running => std::option::Option::Some(3),
                Self::Stopping => std::option::Option::Some(4),
                Self::Stopped => std::option::Option::Some(5),
                Self::Terminated => std::option::Option::Some(6),
                Self::Repairing => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Provisioning => std::option::Option::Some("PROVISIONING"),
                Self::Staging => std::option::Option::Some("STAGING"),
                Self::Running => std::option::Option::Some("RUNNING"),
                Self::Stopping => std::option::Option::Some("STOPPING"),
                Self::Stopped => std::option::Option::Some("STOPPED"),
                Self::Terminated => std::option::Option::Some("TERMINATED"),
                Self::Repairing => std::option::Option::Some("REPAIRING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Provisioning,
                2 => Self::Staging,
                3 => Self::Running,
                4 => Self::Stopping,
                5 => Self::Stopped,
                6 => Self::Terminated,
                7 => Self::Repairing,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "PROVISIONING" => Self::Provisioning,
                "STAGING" => Self::Staging,
                "RUNNING" => Self::Running,
                "STOPPING" => Self::Stopping,
                "STOPPED" => Self::Stopped,
                "TERMINATED" => Self::Terminated,
                "REPAIRING" => Self::Repairing,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Provisioning => serializer.serialize_i32(1),
                Self::Staging => serializer.serialize_i32(2),
                Self::Running => serializer.serialize_i32(3),
                Self::Stopping => serializer.serialize_i32(4),
                Self::Stopped => serializer.serialize_i32(5),
                Self::Terminated => serializer.serialize_i32(6),
                Self::Repairing => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.licensemanager.v1.Instance.State",
            ))
        }
    }
}

/// Message describing total counts of users who accessed a VM.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Usage {
    /// LiMa Instance resource name, i.e.
    /// projects/{project}/locations/{location}/instances/{instance}
    pub lima_instance: std::string::String,

    /// Number of unique users accessing the VM.
    pub users: i32,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Usage {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [lima_instance][crate::model::Usage::lima_instance].
    pub fn set_lima_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.lima_instance = v.into();
        self
    }

    /// Sets the value of [users][crate::model::Usage::users].
    pub fn set_users<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.users = v.into();
        self
    }
}

impl wkt::message::Message for Usage {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.Usage"
    }
}

/// Message for requesting list of Configurations
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConfigurationsRequest {
    /// Required. Parent value for ListConfigurationsRequest
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListConfigurationsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListConfigurationsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListConfigurationsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListConfigurationsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListConfigurationsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListConfigurationsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListConfigurationsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.ListConfigurationsRequest"
    }
}

/// Message for response to listing Configurations
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConfigurationsResponse {
    /// The list of Configuration
    pub configurations: std::vec::Vec<crate::model::Configuration>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListConfigurationsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [configurations][crate::model::ListConfigurationsResponse::configurations].
    pub fn set_configurations<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Configuration>,
    {
        use std::iter::Iterator;
        self.configurations = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListConfigurationsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListConfigurationsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListConfigurationsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.ListConfigurationsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListConfigurationsResponse {
    type PageItem = crate::model::Configuration;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.configurations
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Configuration
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConfigurationRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetConfigurationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetConfigurationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetConfigurationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.GetConfigurationRequest"
    }
}

/// Message for creating a Configuration
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConfigurationRequest {
    /// Required. Value for parent.
    pub parent: std::string::String,

    /// Required. Id of the requesting object
    pub configuration_id: std::string::String,

    /// Required. The resource being created
    pub configuration: std::option::Option<crate::model::Configuration>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateConfigurationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateConfigurationRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [configuration_id][crate::model::CreateConfigurationRequest::configuration_id].
    pub fn set_configuration_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.configuration_id = v.into();
        self
    }

    /// Sets the value of [configuration][crate::model::CreateConfigurationRequest::configuration].
    pub fn set_configuration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Configuration>,
    {
        self.configuration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [configuration][crate::model::CreateConfigurationRequest::configuration].
    pub fn set_or_clear_configuration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Configuration>,
    {
        self.configuration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateConfigurationRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateConfigurationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.CreateConfigurationRequest"
    }
}

/// Message for updating a Configuration
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateConfigurationRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// Configuration resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If the
    /// user does not provide a mask then all fields will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The resource being updated
    pub configuration: std::option::Option<crate::model::Configuration>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateConfigurationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateConfigurationRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateConfigurationRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [configuration][crate::model::UpdateConfigurationRequest::configuration].
    pub fn set_configuration<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Configuration>,
    {
        self.configuration = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [configuration][crate::model::UpdateConfigurationRequest::configuration].
    pub fn set_or_clear_configuration<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Configuration>,
    {
        self.configuration = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateConfigurationRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateConfigurationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.UpdateConfigurationRequest"
    }
}

/// Message for deleting a Configuration
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteConfigurationRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteConfigurationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteConfigurationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteConfigurationRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteConfigurationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.DeleteConfigurationRequest"
    }
}

/// Message for requesting list of Instances
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesRequest {
    /// Required. Parent value for ListInstancesRequest
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListInstancesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.ListInstancesRequest"
    }
}

/// Message for response to listing Instances
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesResponse {
    /// The list of Instance
    pub instances: std::vec::Vec<crate::model::Instance>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
    pub fn set_instances<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Instance>,
    {
        use std::iter::Iterator;
        self.instances = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListInstancesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.ListInstancesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
    type PageItem = crate::model::Instance;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.instances
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Instance
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetInstanceRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.GetInstanceRequest"
    }
}

/// Message for requesting license usage per configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryConfigurationLicenseUsageRequest {
    /// Required. The resource path of the Configuration.
    pub name: std::string::String,

    /// Required. The start time for retrieving the usage. If not specified, we
    /// will use the first day of the current billing period.
    pub start_time: std::option::Option<wkt::Timestamp>,

    /// Required. The end time for retrieving the usage. If not specified, we will
    /// use the last day of the current billing period.
    pub end_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryConfigurationLicenseUsageRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::QueryConfigurationLicenseUsageRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [start_time][crate::model::QueryConfigurationLicenseUsageRequest::start_time].
    pub fn set_start_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [start_time][crate::model::QueryConfigurationLicenseUsageRequest::start_time].
    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::QueryConfigurationLicenseUsageRequest::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::QueryConfigurationLicenseUsageRequest::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for QueryConfigurationLicenseUsageRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.QueryConfigurationLicenseUsageRequest"
    }
}

/// Message for response to get the license usage per configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryConfigurationLicenseUsageResponse {
    /// Depending on the type of the configuration, one of the following
    /// will be populated.
    pub details:
        std::option::Option<crate::model::query_configuration_license_usage_response::Details>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryConfigurationLicenseUsageResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [details][crate::model::QueryConfigurationLicenseUsageResponse::details].
    ///
    /// Note that all the setters affecting `details` are mutually
    /// exclusive.
    pub fn set_details<
        T: std::convert::Into<
                std::option::Option<
                    crate::model::query_configuration_license_usage_response::Details,
                >,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.details = v.into();
        self
    }

    /// The value of [details][crate::model::QueryConfigurationLicenseUsageResponse::details]
    /// if it holds a `UserCountUsage`, `None` if the field is not set or
    /// holds a different branch.
    pub fn user_count_usage(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::UserCountUsage>> {
        #[allow(unreachable_patterns)]
        self.details.as_ref().and_then(|v| match v {
            crate::model::query_configuration_license_usage_response::Details::UserCountUsage(
                v,
            ) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [details][crate::model::QueryConfigurationLicenseUsageResponse::details]
    /// to hold a `UserCountUsage`.
    ///
    /// Note that all the setters affecting `details` are
    /// mutually exclusive.
    pub fn set_user_count_usage<
        T: std::convert::Into<std::boxed::Box<crate::model::UserCountUsage>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.details = std::option::Option::Some(
            crate::model::query_configuration_license_usage_response::Details::UserCountUsage(
                v.into(),
            ),
        );
        self
    }
}

impl wkt::message::Message for QueryConfigurationLicenseUsageResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.QueryConfigurationLicenseUsageResponse"
    }
}

/// Defines additional types related to [QueryConfigurationLicenseUsageResponse].
pub mod query_configuration_license_usage_response {
    #[allow(unused_imports)]
    use super::*;

    /// Depending on the type of the configuration, one of the following
    /// will be populated.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Details {
        /// Usage information for license types which use user-count billing.
        UserCountUsage(std::boxed::Box<crate::model::UserCountUsage>),
    }
}

/// Message for deactivating a Configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeactivateConfigurationRequest {
    /// Required. Name of the resource.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeactivateConfigurationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeactivateConfigurationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeactivateConfigurationRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeactivateConfigurationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.DeactivateConfigurationRequest"
    }
}

/// Message for resuming a Configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReactivateConfigurationRequest {
    /// Required. Name of the resource.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ReactivateConfigurationRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ReactivateConfigurationRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::ReactivateConfigurationRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for ReactivateConfigurationRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.ReactivateConfigurationRequest"
    }
}

/// Message for requesting aggregate of Usage per configuration.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AggregateUsageRequest {
    /// Required. Parent value for AggregateUsageRequest
    pub name: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    /// Required. Licenses are purchased per month - so usage track needs start
    /// time of a month.
    pub start_time: std::option::Option<wkt::Timestamp>,

    /// Required. Usage track is always for a month. This parameter is for the end
    /// time of the month.
    pub end_time: std::option::Option<wkt::Timestamp>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AggregateUsageRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::AggregateUsageRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::AggregateUsageRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::AggregateUsageRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::AggregateUsageRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::AggregateUsageRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }

    /// Sets the value of [start_time][crate::model::AggregateUsageRequest::start_time].
    pub fn set_start_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [start_time][crate::model::AggregateUsageRequest::start_time].
    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.start_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::AggregateUsageRequest::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::AggregateUsageRequest::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for AggregateUsageRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.AggregateUsageRequest"
    }
}

/// Message for response for aggregating usage count
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AggregateUsageResponse {
    /// The aggregated records of usage per configuration
    pub usages: std::vec::Vec<crate::model::Usage>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AggregateUsageResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [usages][crate::model::AggregateUsageResponse::usages].
    pub fn set_usages<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Usage>,
    {
        use std::iter::Iterator;
        self.usages = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::AggregateUsageResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::AggregateUsageResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for AggregateUsageResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.AggregateUsageResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for AggregateUsageResponse {
    type PageItem = crate::model::Usage;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.usages
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for requesting list of Products
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProductsRequest {
    /// Required. Parent value for ListProductsRequest
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProductsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListProductsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListProductsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.ListProductsRequest"
    }
}

/// Message for response to listing Products
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListProductsResponse {
    /// The list of Product
    pub products: std::vec::Vec<crate::model::Product>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListProductsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [products][crate::model::ListProductsResponse::products].
    pub fn set_products<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Product>,
    {
        use std::iter::Iterator;
        self.products = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListProductsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListProductsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.ListProductsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListProductsResponse {
    type PageItem = crate::model::Product;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.products
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Product
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetProductRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetProductRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetProductRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetProductRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.GetProductRequest"
    }
}

/// Represents the metadata of the long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have been cancelled successfully
    /// have
    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.licensemanager.v1.OperationMetadata"
    }
}

/// Different types of licenses that are supported.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LicenseType {
    /// unspecified.
    Unspecified,
    /// Billing will be based on number of users listed per month.
    PerMonthPerUser,
    /// Bring your own license.
    BringYourOwnLicense,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [LicenseType::value] or
    /// [LicenseType::name].
    UnknownValue(license_type::UnknownValue),
}

#[doc(hidden)]
pub mod license_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl LicenseType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::PerMonthPerUser => std::option::Option::Some(1),
            Self::BringYourOwnLicense => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("LICENSE_TYPE_UNSPECIFIED"),
            Self::PerMonthPerUser => std::option::Option::Some("LICENSE_TYPE_PER_MONTH_PER_USER"),
            Self::BringYourOwnLicense => {
                std::option::Option::Some("LICENSE_TYPE_BRING_YOUR_OWN_LICENSE")
            }
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for LicenseType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for LicenseType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for LicenseType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::PerMonthPerUser,
            2 => Self::BringYourOwnLicense,
            _ => Self::UnknownValue(license_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for LicenseType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "LICENSE_TYPE_UNSPECIFIED" => Self::Unspecified,
            "LICENSE_TYPE_PER_MONTH_PER_USER" => Self::PerMonthPerUser,
            "LICENSE_TYPE_BRING_YOUR_OWN_LICENSE" => Self::BringYourOwnLicense,
            _ => Self::UnknownValue(license_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for LicenseType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::PerMonthPerUser => serializer.serialize_i32(1),
            Self::BringYourOwnLicense => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for LicenseType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<LicenseType>::new(
            ".google.cloud.licensemanager.v1.LicenseType",
        ))
    }
}

/// State of the License Key activation on the instance.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ActivationState {
    /// The Status of the activation is unspecified
    Unspecified,
    /// Activation key (MAK) requested for the instance.
    KeyRequested,
    /// License activation process is running on the instance.
    Activating,
    /// License activation is complete on the instance.
    Activated,
    /// License Key is deactivating on the instance.
    Deactivating,
    /// License Key is deactivated on the instance.
    Deactivated,
    /// License Key activation failed on the instance.
    Terminated,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ActivationState::value] or
    /// [ActivationState::name].
    UnknownValue(activation_state::UnknownValue),
}

#[doc(hidden)]
pub mod activation_state {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ActivationState {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::KeyRequested => std::option::Option::Some(1),
            Self::Activating => std::option::Option::Some(2),
            Self::Activated => std::option::Option::Some(3),
            Self::Deactivating => std::option::Option::Some(4),
            Self::Deactivated => std::option::Option::Some(5),
            Self::Terminated => std::option::Option::Some(6),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("ACTIVATION_STATE_UNSPECIFIED"),
            Self::KeyRequested => std::option::Option::Some("ACTIVATION_STATE_KEY_REQUESTED"),
            Self::Activating => std::option::Option::Some("ACTIVATION_STATE_ACTIVATING"),
            Self::Activated => std::option::Option::Some("ACTIVATION_STATE_ACTIVATED"),
            Self::Deactivating => std::option::Option::Some("ACTIVATION_STATE_DEACTIVATING"),
            Self::Deactivated => std::option::Option::Some("ACTIVATION_STATE_DEACTIVATED"),
            Self::Terminated => std::option::Option::Some("ACTIVATION_STATE_TERMINATED"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ActivationState {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ActivationState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ActivationState {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::KeyRequested,
            2 => Self::Activating,
            3 => Self::Activated,
            4 => Self::Deactivating,
            5 => Self::Deactivated,
            6 => Self::Terminated,
            _ => Self::UnknownValue(activation_state::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ActivationState {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "ACTIVATION_STATE_UNSPECIFIED" => Self::Unspecified,
            "ACTIVATION_STATE_KEY_REQUESTED" => Self::KeyRequested,
            "ACTIVATION_STATE_ACTIVATING" => Self::Activating,
            "ACTIVATION_STATE_ACTIVATED" => Self::Activated,
            "ACTIVATION_STATE_DEACTIVATING" => Self::Deactivating,
            "ACTIVATION_STATE_DEACTIVATED" => Self::Deactivated,
            "ACTIVATION_STATE_TERMINATED" => Self::Terminated,
            _ => Self::UnknownValue(activation_state::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ActivationState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::KeyRequested => serializer.serialize_i32(1),
            Self::Activating => serializer.serialize_i32(2),
            Self::Activated => serializer.serialize_i32(3),
            Self::Deactivating => serializer.serialize_i32(4),
            Self::Deactivated => serializer.serialize_i32(5),
            Self::Terminated => serializer.serialize_i32(6),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ActivationState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActivationState>::new(
            ".google.cloud.licensemanager.v1.ActivationState",
        ))
    }
}
